package com.recruit.service;

import com.recruit.dao.UserLoginAndResgitDao;
import com.recruit.entity.User;

import java.sql.SQLException;

/****
 * author:丁文彬
 * time：2020.9.25
 */
public class UserLoginAndRegistService {
    //dao层
    private UserLoginAndResgitDao userLoginAndResgitDao = new UserLoginAndResgitDao();
    User user = null;
    //影响的行数
    int index = 0;

    //登录
    public User userLogin(String username,String password){
        try {
            user = userLoginAndResgitDao.selectUserByUsernameAndPassword(username, password);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return user;
    }

    //注册
    public int userRegister(User user){
        try {
            index = userLoginAndResgitDao.insertUser(user);
        } catch (SQLException e) {
            e.printStackTrace();
        }

        return index;
    }





}
